package com.wnxy;


import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;

/**
 * 元数据区: -XX:MetaspaceSize=10m -XX:MaxMetaspaceSize=10m
 **/
public class App2 {
    public static void main(final String[] args) {
        while (true){
            // 创建字节码增强器对象
            Enhancer enhancer = new Enhancer();
            // 设置父类
            enhancer.setSuperclass(App2.class);
            // 设置是否使用缓存
            enhancer.setUseCache(false);
            // 设置回调对象(方法拦截器)
            enhancer.setCallback((MethodInterceptor) (o, method, objects, methodProxy) -> methodProxy.invoke(o,args));
            enhancer.create();
        }
    }
}